package util

import "time"

type DateFormatter string

const (
	DATE_FMT     DateFormatter = "2006-01-02"
	DATETIME_FMT DateFormatter = "2006-01-02 15:04:05"
	TIME_FMT     DateFormatter = "15:04:05"
)

func DateForamt(time *time.Time, fmt DateFormatter) string {
	return time.Format(string(fmt))
}

func NowFormat(fmt DateFormatter) string {
	return time.Now().Format(string(fmt))
}

func ParseDate(t string, fmt DateFormatter) (time.Time, error) {
	return time.ParseInLocation(string(fmt), t, time.Local)
}
